sugarfreeFilters.filter('lessonTplFilter',['TimeService',function(timeService) { 
	  return function(input,dayOfWeek,grp) {
//	  console.log('input',input);
//	  console.log('dayOfWeek',dayOfWeek);
//	  console.log('grp',grp);
		var group = timeService.getTimeGroupRange(grp); 
		var output = [];
		if(input){
			for(var i = 0 ; i< input.length ; i++){
				if(input[i].dayOfWeek === dayOfWeek && input[i].hourOfDay >= group.startHour && input[i].hourOfDay < group.endHour){
					output.push(input[i]);
				}
			}
		}
		return output;
	  };
}]);


sugarfreeFilters.filter('timeGroupFilter',['TimeService',function(timeService) { 
	  return function(input,group) {
		var find = timeService.getTimeGroupRange(group); 
		var output;
		if(input){
			output = find;
		}
		//console.log("output",output);
		return output;
	  };
}]);


sugarfreeFilters.filter('range',function() {
  return function(input, start, end) {    
    start = parseInt(start);
    end = parseInt(end);
    var direction = (start <= end) ? 1 : -1;
    while (start !== end) {
        input.push(start);
        start += direction;
    }
    return input;
  };
});

sugarfreeFilters.filter('dateParse', function() {
  return function(input) {
    return Date.parse(input);
  };
});

sugarfreeFilters.filter('dateFormat',['TimeService', function(timeService) {
  return function(input) {
    return timeService.patten(input);
  };
}]);



sugarfreeFilters.filter('trim', function() {
  return function(input) {
  	if(input===null || input==='null'){
  		return '';
  	}
  	var str = input.replace(/(^\s*)|(\s*$)/g,'') ;
    return str;
  };
});
